package com.zlr.store.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.zlr.common.BaseAction;
import com.zlr.store.entity.SysUser;
import com.zlr.store.service.SysUserService;

@Controller
@Scope("prototype")
public class LoginAction extends BaseAction {

	private static final long serialVersionUID = 1L;

	private SysUser sysUser;

	@Autowired
	private SysUserService sysUserService;

	public SysUser getSysUser() {
		return sysUser;
	}

	public void setSysUser(SysUser sysUser) {
		this.sysUser = sysUser;
	}

	public String login() {
		SysUser user = new SysUser();
		user = sysUserService.doLogin(user.getCode(), user.getPassword());
		System.out.println(user);
		if (user != null) {
			return "success";
		} else {
			return "index";
		}

	}

}
